import 'package:flutter_app/model/user.dart';
import 'package:flutter_app/redux/user_redux.dart';

///全局Redux store 的对象，保存State数据
class APPState {
  ///用户信息
  User userInfo;

  ///构造方法
  APPState({
    this.userInfo,
  });
}

///创建 Reducer
///源码中 Reducer 是一个方法 typedef State Reducer<State>(State state, dynamic action);
///我们自定义了 appReducer 用于创建 store
APPState appReducer(APPState state, action) {
  return APPState(
    ///通过自定义 UserReducer 将 APPState 内的 userInfo 和 action 关联在一起
    userInfo: userReducer(state.userInfo, action),
  );
}
